#ifndef CCUSTOMBADGE_H_
#define CCUSTOMBADGE_H_

#include <QWidget>

class CCustomBadge : public QWidget
{
    Q_OBJECT
public:
    CCustomBadge(QWidget* p = Q_NULLPTR);
    ~CCustomBadge();

    inline bool SetIcon(const QString& path) { return icon_.load(path); }

protected:
    void paintEvent(QPaintEvent* e) override;
    void mousePressEvent(QMouseEvent* e) override;
    void mouseMoveEvent(QMouseEvent* e) override;
    void mouseReleaseEvent(QMouseEvent* e) override;
    void leaveEvent(QEvent *event);

    void automatic_adsorption();

signals:
    void clicked();

private:
    QImage icon_;
    QWidget* parent_;

    ulong       ms_ts_;

    bool        flag_drag_;
    bool        flag_drag_continue_;
    int         drag_posx_;
    int         drag_posy_;
};

#endif // CCUSTOMBADGE_H_
